﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using FTchina;
using FTchina.Library;

public partial class UI_sso : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Redirect("login.aspx?logintype=remote");
        if (!(FTchina.basic.SafeRequest(Request["admin"]).ToString() == "admin"))
        {
            Response.Redirect("login.aspx");
        }
       
        string name = "admin";


        using (DataTable dt = shujuku.GetDataTable("select  m.*,u.id as uid  from master as m,userlist As u where m.nicheng='" + name + "' and m.link=u.id"))
        {

            MasterHelper.MasterID = MD5MK.MD5String(FTchina.basic.GetGuid());
            MasterHelper.MasterName = dt.Rows[0]["Master_Name"].ToString().Trim();
            MasterHelper.MasterPower = dt.Rows[0]["power"].ToString().Trim();
            MasterHelper.MasterPowerName = dt.Rows[0]["pname"].ToString().Trim();
            MasterHelper.Nickname = name;
            MasterHelper.Luruid = dt.Rows[0]["uid"].ToString().Trim();
            MasterHelper.LoginIP = basic.GetUserIp(this);
            string update = "update loginChk set lasttime='" + basic.GetSqliteDate() + "' ";
            shujuku.ExecuteSql(update);
            
            //  ClientScript.RegisterStartupScript ( this.GetType ( ) , "start" , "var win=window.open('../index.aspx','','top=0,left=0,scrollbars=no,status=0,directory=0,location=0');var h = screen.availHeight;var w = screen.availWidth;win.resizeTo(w,h);window.opener=null;window.open('','_self');window.close();" , true );
            Response.Redirect("../main.aspx");
        }
    }
}